/**
 * LogScoreService.java
 * Copyright(C) 1949++ 中华人民共和国
 * 深圳市盛开互联网金融顾问有限公司.
 * All rights reserved.
 * E-mail:server@skjr.net
 * SKDate:2017-11-16 17:28:58
 */
package com.huamao.zh.service.impl;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.huamao.zh.base.PageWrapper;
import com.huamao.zh.mapper.LogScoreMapper;
import com.huamao.zh.model.LogScore;
import com.huamao.zh.service.LogScoreService;

@Service
@Transactional
public class LogScoreServiceImpl implements LogScoreService {

	@Autowired
	private LogScoreMapper logScoreMapper;

	/**
	 * 功能说明：新增积分流水 Author：Bourne SKDate:2017-11-16 17:28:58
	 */
	public LogScore add(LogScore logScore) throws Exception {
		logScoreMapper.add(logScore);
		return logScore;
	}

	public LogScore add(int type, int fromId, int userId, String orderNo, BigDecimal preScore, int scoreType,
			BigDecimal getScore, String remark) throws Exception {
		LogScore logScore = new LogScore();
		logScore.setType(type);
		logScore.setFromId(fromId);
		logScore.setUserId(userId);
		logScore.setOrderNo(orderNo);
		logScore.setPreScore(preScore);
		logScore.setScoreType(scoreType);
		logScore.setScore(getScore);
		logScore.setRemark(remark);
		logScore.setDataFlag(1);
		logScore.setCreateTime(new Date());
		logScoreMapper.add(logScore);
		return logScore;
	}

	/**
	 * 功能说明： Author： SKDate:2017-11-16 17:28:58
	 */
	public LogScore addSelective(LogScore logScore) throws Exception {
		logScoreMapper.addSelective(logScore);
		return logScore;
	}

	/**
	 * 功能说明： Author： SKDate:2017-11-16 17:28:58
	 */
	public int delete(Map<String, Object> map) {
		return logScoreMapper.delete(map);
	}

	/**
	 * 功能说明： Author： SKDate:2017-11-16 17:28:58
	 */
	public int update(LogScore logScore) throws Exception {
		return logScoreMapper.update(logScore);
	}

	/**
	 * 功能说明： Author： SKDate:2017-11-16 17:28:58
	 */
	public int updateSelective(LogScore logScore) throws Exception {
		return logScoreMapper.updateSelective(logScore);
	}

	/**
	 * 功能说明： Author： SKDate:2017-11-16 17:28:58
	 */
	public LogScore get(Integer id) {
		LogScore logScore = logScoreMapper.get(id);
		return logScore;
	}

	/**
	 * 功能说明： Author： SKDate:2017-11-16 17:28:58
	 */
	public PageWrapper<LogScore> search(PageWrapper<LogScore> pageWrapper) {
		List<LogScore> logScores = logScoreMapper.search(pageWrapper);
		pageWrapper.setList(logScores);
		return pageWrapper;
	}

	/**
	 * 功能说明： Author： SKDate:2017-11-16 17:28:58
	 */
	public List<LogScore> queryList(Map<String, Object> map) {
		return logScoreMapper.queryList(map);
	}
}